package cn.kdyzm.controller;

import cn.kdyzm.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author kdyzm
 * @date 2025/9/28
 */
@RestController
@RequestMapping("/test")
@AllArgsConstructor
public class CacheTestCongroller {

    private final UserService userService;

    @GetMapping("/testGet")
    public String test(){
        // 第一次查询 - 会访问数据库
        UserService.User user1 = userService.getUserById(1L);
        return "OK";
    }

    @GetMapping("/testDelete")
    public String testDelete(){
        // 第一次查询 - 会访问数据库
        userService.deleteUser(1L);
        return "OK";
    }



}
